global root_path "/Volumes/Workgroup/Lab/Lab-heimb/Montenovo/Volunteering Paper/Data"

clear all
set maxvar 32767

cd "$root_path/02_ready_for_PSIDclean"
use individ_family_2017.dta, clear

cd "$root_path/03_ready_for_TAXSIM"

rename ER66002 family_id

gen unique_id_crossys=(ER30001*1000) + ER30002

gen sequence_num=ER34502



rename ER30000 release_number
rename ER30001 interview_number_1986
rename ER30002 person_number

* wife
gen white_w=0
replace white_w=1 if ER70744==1 & ER70745==0 & ER70746==0 & ER70747==0

gen black_w=0
replace black_w=1 if ER70744==2 & ER70745==0 & ER70746==0 & ER70747==0

gen native_amer_w=0
replace native_amer_w=1 if ER70744==3 & ER70745==0 & ER70746==0 & ER70747==0

gen asian_w=0
replace asian_w=1 if ER70744==4 & ER70745==0 & ER70746==0 & ER70747==0

*gen latino_w=0
*replace latino_w=1 if ER70744==5 & ER70745==0 & ER70746==0 & ER70747==0

gen other_w=0
replace other_w=1 if (ER70744>=5) 
replace other_w=1 if ER70745!=0 | ER70746!=0 | ER70747!=0

gen any_race_w=white_w+black_w+native_amer_w+asian_w+other_w
sum any_race_w

*  3,721 have no recorded race in OUR data
*  3,524: no wife present
*  3,721-3,524 are mixed race so we did not code them yet

* husband
gen white_h=0
replace white_h=1 if ER70882==1 & ER70883==0 & ER70884==0 & ER70885==0

gen black_h=0
replace black_h=1 if ER70882==2 & ER70883==0 & ER70884==0 & ER70885==0

gen native_amer_h=0
replace native_amer_h=1 if ER70882==3 & ER70883==0 & ER70884==0 & ER70885==0

gen asian_h=0
replace asian_h=1 if ER70882==4 & ER70883==0 & ER70884==0 & ER70885==0

gen latino_h=0
replace latino_h=1 if ER70882==5 & ER70883==0 & ER70884==0 & ER70885==0

gen other_h=0
replace other_h=1 if (ER70882>=5) 
replace other_h=1 if ER70883!=0 | ER70884!=0 | ER70885!=0

gen any_race_h=white_h+black_h+native_amer_h+asian_h+other_h
sum any_race_h

*  7,524 have no recorded race in OUR data
*  298: are mixed race so we did not code them yet

** Identifiers.
** State of residence.
rename ER66003 state_residence
rename ER66004 state_current
rename ER66018  sex_head
rename ER66020 sex_spouse

** RAW FIELDS.
** Marriage stuff.
rename ER66024 marital_status_head
rename ER71540 marital_status_generated

gen married=0
replace married=1 if marital_status_head==1

keep if (sequence_num==1 & married==0) | (sequence_num==1 & married==1) | (sequence_num==2 & married==1)


** Children.
rename ER66021 children
** Ages.
rename ER66017 age_head
rename ER66019 age_wife
rename ER66022 age_youngest_child
** Salary.
rename ER66164 emplstat_head
rename ER66168 work_for_money_head
rename ER66210 how_paid_head
rename ER66211 salary_hd
rename ER66212 salary_frequency_head
rename ER66439 emplstat_wife
rename ER66443 work_for_money_wife
rename ER66486 salary_wife
rename ER66487 salary_frequency_wife
** Batch income fields.
rename ER66972 g4_pyr_net_farm_income
rename ER66987 g11b_profit_loss_bus_1
rename ER66988 g11b_profit_loss_bus_2
rename ER66989 g11b_profit_loss_bus_3
rename ER66990 g11b_profit_loss_bus_4
rename ER66991 g11b_profit_loss_bus_5
rename ER67048 g14_16_hd_bonus_ot_comm
rename ER67062 amt_other_labor_y_head
rename ER67065 g18a_wtr_head_prof_pract
rename ER67069 prof_trade_income_h_jan
rename ER67070 prof_trade_income_h_feb
rename ER67071 prof_trade_income_h_mar
rename ER67072 prof_trade_income_h_apr
rename ER67073 prof_trade_income_h_may
rename ER67074 prof_trade_income_h_jun
rename ER67075 prof_trade_income_h_jul
rename ER67076 prof_trade_income_h_aug
rename ER67077 prof_trade_income_h_sep
rename ER67078 prof_trade_income_h_oct
rename ER67079 prof_trade_income_h_nov
rename ER67080 prof_trade_income_h_dec
/*
rename ER36964 g18b_wtr_head_mkt_gdning
rename ER36968 garden_farm_income_h_jan
rename ER36969 garden_farm_income_h_feb
rename ER36970 garden_farm_income_h_mar
rename ER36971 garden_farm_income_h_apr
rename ER36972 garden_farm_income_h_may
rename ER36973 garden_farm_income_h_jun
rename ER36974 garden_farm_income_h_jul
rename ER36975 garden_farm_income_h_aug
rename ER36976 garden_farm_income_h_sep
rename ER36977 garden_farm_income_h_oct
rename ER36978 garden_farm_income_h_nov
rename ER36979 garden_farm_income_h_dec
rename ER36981 g18c_wtr_head_roomers
rename ER36985 room_bord_income_h_jan
rename ER36986 room_bord_income_h_feb
rename ER36987 room_bord_income_h_mar
rename ER36988 room_bord_income_h_apr
rename ER36989 room_bord_income_h_may
rename ER36990 room_bord_income_h_jun
rename ER36991 room_bord_income_h_jul
rename ER36992 room_bord_income_h_aug
rename ER36993 room_bord_income_h_sep
rename ER36994 room_bord_income_h_oct
rename ER36995 room_bord_income_h_nov
rename ER36996 room_bord_income_h_dec
*/
rename ER67085 g25a_whether_rent_head
rename ER67090 rent_income_head_jan
rename ER67091 rent_income_head_feb
rename ER67092 rent_income_head_mar
rename ER67093 rent_income_head_apr
rename ER67094 rent_income_head_may
rename ER67095 rent_income_head_jun
rename ER67096 rent_income_head_jul
rename ER67097 rent_income_head_aug
rename ER67098 rent_income_head_sep
rename ER67099 rent_income_head_oct
rename ER67100 rent_income_head_nov
rename ER67101 rent_income_head_dec
rename ER67102 g25b_whether_dividends_head
rename ER67103 dividends_head_amt
rename ER67104 dividends_head_freq
rename ER67106 dividends_head_include_wife
rename ER67107 dividend_income_head_jan
rename ER67108 dividend_income_head_feb
rename ER67109 dividend_income_head_mar
rename ER67110 dividend_income_head_apr
rename ER67111 dividend_income_head_may
rename ER67112 dividend_income_head_jun
rename ER67113 dividend_income_head_jul
rename ER67114 dividend_income_head_aug
rename ER67115 dividend_income_head_sep
rename ER67116 dividend_income_head_oct
rename ER67117 dividend_income_head_nov
rename ER67118 dividend_income_head_dec
rename ER67119 g25c_whether_interest_head
rename ER67124 interest_income_head_jan
rename ER67125 interest_income_head_feb
rename ER67126 interest_income_head_mar
rename ER67127 interest_income_head_apr
rename ER67128 interest_income_head_may
rename ER67129 interest_income_head_jun
rename ER67130 interest_income_head_jul
rename ER67131 interest_income_head_aug
rename ER67132 interest_income_head_sep
rename ER67133 interest_income_head_oct
rename ER67134 interest_income_head_nov
rename ER67135 interest_income_head_dec
rename ER67136 whether_trust_fund_head
rename ER67140 trust_royal_income_h_jan
rename ER67141 trust_royal_income_h_feb
rename ER67142 trust_royal_income_h_mar
rename ER67143 trust_royal_income_h_apr
rename ER67144 trust_royal_income_h_may
rename ER67145 trust_royal_income_h_jun
rename ER67146 trust_royal_income_h_jul
rename ER67147 trust_royal_income_h_aug
rename ER67148 trust_royal_income_h_sep
rename ER67149 trust_royal_income_h_oct
rename ER67150 trust_royal_income_h_nov
rename ER67151 trust_royal_income_h_dec
rename ER67153 g25e_whether_adc_tanf_head
rename ER67157 adc_tanf_income_head_jan
rename ER67158 adc_tanf_income_head_feb
rename ER67159 adc_tanf_income_head_mar
rename ER67160 adc_tanf_income_head_apr
rename ER67161 adc_tanf_income_head_may
rename ER67162 adc_tanf_income_head_jun
rename ER67163 adc_tanf_income_head_jul
rename ER67164 adc_tanf_income_head_aug
rename ER67165 adc_tanf_income_head_sep
rename ER67166 adc_tanf_income_head_oct
rename ER67167 adc_tanf_income_head_nov
rename ER67168 adc_tanf_income_head_dec
rename ER67169 g25f_whether_ssi_head
rename ER67171 ssi_of_head
rename ER67172 ssi_of_head_per
rename ER67174 ssi_income_head_jan
rename ER67175 ssi_income_head_feb
rename ER67176 ssi_income_head_mar
rename ER67177 ssi_income_head_apr
rename ER67178 ssi_income_head_may
rename ER67179 ssi_income_head_jun
rename ER67180 ssi_income_head_jul
rename ER67181 ssi_income_head_aug
rename ER67182 ssi_income_head_sep
rename ER67183 ssi_income_head_oct
rename ER67184 ssi_income_head_nov
rename ER67185 ssi_income_head_dec
rename ER67186 g25g_whether_other_welfare_hd
rename ER67190 otr_welfare_income_h_jan
rename ER67191 otr_welfare_income_h_feb
rename ER67192 otr_welfare_income_h_mar
rename ER67193 otr_welfare_income_h_apr
rename ER67194 otr_welfare_income_h_may
rename ER67195 otr_welfare_income_h_jun
rename ER67196 otr_welfare_income_h_jul
rename ER67197 otr_welfare_income_h_aug
rename ER67198 otr_welfare_income_h_sep
rename ER67199 otr_welfare_income_h_oct
rename ER67200 otr_welfare_income_h_nov
rename ER67201 otr_welfare_income_h_dec
rename ER67202 g31_any_fu_memb_get_socsec
//rename ER37118 g37_whether_head_va_pension ASK BRAD


rename ER67210 va_income_head_jan
rename ER67211 va_income_head_feb
rename ER67212 va_income_head_mar
rename ER67213 va_income_head_apr
rename ER67214 va_income_head_may
rename ER67215 va_income_head_jun
rename ER67216 va_income_head_jul
rename ER67217 va_income_head_aug
rename ER67218 va_income_head_sep
rename ER67219 va_income_head_oct
rename ER67220 va_income_head_nov
rename ER67221 va_income_head_dec
rename ER67222 g40a_wtr_nonva_retiremt_head
rename ER67223 nonva_retiremt_head_amt
rename ER67224 nonva_retiremt_head_unit
rename ER67226 retirement_income_h_jan
rename ER67227 retirement_income_h_feb
rename ER67228 retirement_income_h_mar
rename ER67229 retirement_income_h_apr
rename ER67230 retirement_income_h_may
rename ER67231 retirement_income_h_jun
rename ER67232 retirement_income_h_jul
rename ER67233 retirement_income_h_aug
rename ER67234 retirement_income_h_sep
rename ER67235 retirement_income_h_oct
rename ER67236 retirement_income_h_nov
rename ER67237 retirement_income_h_dec

rename ER67238 g40b_whether_head_annuities
/*rename ER67242 annuities_income_jan
rename ER67242 annuities_income_feb
rename ER67242 annuities_income_mar
rename ER67242 annuities_income_apr
rename ER67242 annuities_income_may
rename ER67242 annuities_income_jun
rename ER67242 annuities_income_jul
rename ER67242 annuities_income_aug
rename ER67242 annuities_income_sep
rename ER67242 annuities_income_oct
rename ER67242 annuities_income_nov
rename ER67242 annuities_income_dec
*/
rename ER67254 g40c_whether_head_otr_pension
rename ER67258 otr_pension_head_jan
rename ER67259 otr_pension_head_feb
rename ER67260 otr_pension_head_mar
rename ER67261 otr_pension_head_apr
rename ER67262 otr_pension_head_may
rename ER67263 otr_pension_head_jun
rename ER67264 otr_pension_head_jul
rename ER67265 otr_pension_head_aug
rename ER67266 otr_pension_head_sep
rename ER67267 otr_pension_head_oct
rename ER67268 otr_pension_head_nov
rename ER67269 otr_pension_head_dec
rename ER67286 g43_num_of_head_non_va_pensn
rename ER67291 unemploy_income_head_jan
rename ER67292 unemploy_income_head_feb
rename ER67293 unemploy_income_head_mar
rename ER67294 unemploy_income_head_apr
rename ER67295 unemploy_income_head_may
rename ER67296 unemploy_income_head_jun
rename ER67297 unemploy_income_head_jul
rename ER67298 unemploy_income_head_aug
rename ER67299 unemploy_income_head_sep
rename ER67300 unemploy_income_head_oct
rename ER67301 unemploy_income_head_nov
rename ER67302 unemploy_income_head_dec
rename ER67303 g44b_wtr_workmen_comp_of_head
rename ER67307 worker_comp_income_h_jan
rename ER67308 worker_comp_income_h_feb
rename ER67309 worker_comp_income_h_mar
rename ER67310 worker_comp_income_h_apr
rename ER67311 worker_comp_income_h_may
rename ER67312 worker_comp_income_h_jun
rename ER67313 worker_comp_income_h_jul
rename ER67314 worker_comp_income_h_aug
rename ER67315 worker_comp_income_h_sep
rename ER67316 worker_comp_income_h_oct
rename ER67317 worker_comp_income_h_nov
rename ER67318 worker_comp_income_h_dec
rename ER67319 g44c_wtr_child_support_of_hd
rename ER67323 child_support_inc_h_jan
rename ER67324 child_support_inc_h_feb
rename ER67325 child_support_inc_h_mar
rename ER67326 child_support_inc_h_apr
rename ER67327 child_support_inc_h_may
rename ER67328 child_support_inc_h_jun
rename ER67329 child_support_inc_h_jul
rename ER67330 child_support_inc_h_aug
rename ER67331 child_support_inc_h_sep
rename ER67332 child_support_inc_h_oct
rename ER67333 child_support_inc_h_nov
rename ER67334 child_support_inc_h_dec
rename ER67335 g44d_wtr_alimony_of_head
rename ER67339 alimony_income_head_jan
rename ER67340 alimony_income_head_feb
rename ER67341 alimony_income_head_mar
rename ER67342 alimony_income_head_apr
rename ER67343 alimony_income_head_may
rename ER67344 alimony_income_head_jun
rename ER67345 alimony_income_head_jul
rename ER67346 alimony_income_head_aug
rename ER67347 alimony_income_head_sep
rename ER67348 alimony_income_head_oct
rename ER67349 alimony_income_head_nov
rename ER67350 alimony_income_head_dec
rename ER67355 help_from_relative_h_jan
rename ER67356 help_from_relative_h_feb
rename ER67357 help_from_relative_h_mar
rename ER67358 help_from_relative_h_apr
rename ER67359 help_from_relative_h_may
rename ER67360 help_from_relative_h_jun
rename ER67361 help_from_relative_h_jul
rename ER67362 help_from_relative_h_aug
rename ER67363 help_from_relative_h_sep
rename ER67364 help_from_relative_h_oct
rename ER67365 help_from_relative_h_nov
rename ER67366 help_from_relative_h_dec
rename ER67371 help_from_others_h_jan
rename ER67372 help_from_others_h_feb
rename ER67373 help_from_others_h_mar
rename ER67374 help_from_others_h_apr
rename ER67375 help_from_others_h_may
rename ER67376 help_from_others_h_jun
rename ER67377 help_from_others_h_jul
rename ER67378 help_from_others_h_aug
rename ER67379 help_from_others_h_sep
rename ER67380 help_from_others_h_oct
rename ER67381 help_from_others_h_nov
rename ER67382 help_from_others_h_dec
rename ER67383 g44g_wtr_anything_else_of_hd
rename ER67387 any_other_income_h_jan
rename ER67388 any_other_income_h_feb
rename ER67389 any_other_income_h_mar
rename ER67390 any_other_income_h_apr
rename ER67391 any_other_income_h_may
rename ER67392 any_other_income_h_jun
rename ER67393 any_other_income_h_jul
rename ER67394 any_other_income_h_aug
rename ER67395 any_other_income_h_sep
rename ER67396 any_other_income_h_oct
rename ER67397 any_other_income_h_nov
rename ER67398 any_other_income_h_dec
*rename ER37296 g50_whether_wife_had_income
rename ER67646 unemploy_income_wife_jan
rename ER67647 unemploy_income_wife_feb
rename ER67648 unemploy_income_wife_mar
rename ER67649 unemploy_income_wife_apr
rename ER67650 unemploy_income_wife_may
rename ER67651 unemploy_income_wife_jun
rename ER67652 unemploy_income_wife_jul
rename ER67653 unemploy_income_wife_aug
rename ER67654 unemploy_income_wife_sep
rename ER67655 unemploy_income_wife_oct
rename ER67656 unemploy_income_wife_nov
rename ER67657 unemploy_income_wife_dec
rename ER67661 worker_comp_income_w_jan
rename ER67662 worker_comp_income_w_feb
rename ER67663 worker_comp_income_w_mar
rename ER67664 worker_comp_income_w_apr
rename ER67665 worker_comp_income_w_may
rename ER67666 worker_comp_income_w_jun
rename ER67667 worker_comp_income_w_jul
rename ER67668 worker_comp_income_w_aug
rename ER67669 worker_comp_income_w_sep
rename ER67670 worker_comp_income_w_oct
rename ER67671 worker_comp_income_w_nov
rename ER67672 worker_comp_income_w_dec
rename ER67457 g59a_whether_wife_rent
rename ER67445 rent_income_wife_jan
rename ER67446 rent_income_wife_feb
rename ER67447 rent_income_wife_mar
rename ER67448 rent_income_wife_apr
rename ER67449 rent_income_wife_may
rename ER67450 rent_income_wife_jun
rename ER67451 rent_income_wife_jul
rename ER67452 rent_income_wife_aug
rename ER67453 rent_income_wife_sep
rename ER67454 rent_income_wife_oct
rename ER67455 rent_income_wife_nov
rename ER67456 rent_income_wife_dec
*rename ER67457 g59b_whether_wife_dividends
rename ER67458 dividends_wife_amt
rename ER67459 dividends_wife_freq
rename ER67461 dividends_wife_separate
rename ER67462 dividend_income_wife_jan
rename ER67463 dividend_income_wife_feb
rename ER67464 dividend_income_wife_mar
rename ER67465 dividend_income_wife_apr
rename ER67466 dividend_income_wife_may
rename ER67467 dividend_income_wife_jun
rename ER67468 dividend_income_wife_jul
rename ER67469 dividend_income_wife_aug
rename ER67410 dividend_income_wife_sep
rename ER67411 dividend_income_wife_oct
rename ER67412 dividend_income_wife_nov
rename ER67413 dividend_income_wife_dec
*rename ER67462 g59c_whether_wife_interest
rename ER67479 interest_income_wife_jan
rename ER67480 interest_income_wife_feb
rename ER67481 interest_income_wife_mar
rename ER67482 interest_income_wife_apr
rename ER67483 interest_income_wife_may
rename ER67484 interest_income_wife_jun
rename ER67485 interest_income_wife_jul
rename ER67486 interest_income_wife_aug
rename ER67487 interest_income_wife_sep
rename ER67488 interest_income_wife_oct
rename ER67489 interest_income_wife_nov
rename ER67490 interest_income_wife_dec
rename ER67491 g59d_whether_wife_trust_fund
rename ER67495 trust_income_wife_jan
rename ER67496 trust_income_wife_feb
rename ER67497 trust_income_wife_mar
rename ER67498 trust_income_wife_apr
rename ER67499 trust_income_wife_may
rename ER67500 trust_income_wife_jun
rename ER67501 trust_income_wife_jul
rename ER67502 trust_income_wife_aug
rename ER67503 trust_income_wife_sep
rename ER67504 trust_income_wife_oct
rename ER67505 trust_income_wife_nov
rename ER67506 trust_income_wife_dec
rename ER67524 g60a_whether_wife_recd_ssi
rename ER67526 ssi_of_wife_amt
rename ER67527 ssi_of_wife_amt_per
rename ER67529 ssi_income_wife_jan
rename ER67530 ssi_income_wife_feb
rename ER67531 ssi_income_wife_mar
rename ER67532 ssi_income_wife_apr
rename ER67533 ssi_income_wife_may
rename ER67534 ssi_income_wife_jun
rename ER67535 ssi_income_wife_jul
rename ER67536 ssi_income_wife_aug
rename ER67537 ssi_income_wife_sep
rename ER67538 ssi_income_wife_oct
rename ER67539 ssi_income_wife_nov
rename ER67540 ssi_income_wife_dec
rename ER67673 g60b_wtr_wife_recd_adc_tanf
/*rename ER37422 adc_tanf_income_wife_jan
rename ER37423 adc_tanf_income_wife_feb
rename ER37424 adc_tanf_income_wife_mar
rename ER37425 adc_tanf_income_wife_apr
rename ER37426 adc_tanf_income_wife_may
rename ER37427 adc_tanf_income_wife_jun
rename ER37428 adc_tanf_income_wife_jul
rename ER37429 adc_tanf_income_wife_aug
rename ER37430 adc_tanf_income_wife_sep
rename ER37431 adc_tanf_income_wife_oct
rename ER37432 adc_tanf_income_wife_nov
rename ER37433 adc_tanf_income_wife_dec

rename ER37434 g60c_wtr_wf_recd_child_supprt
*/
rename ER67677 child_support_inc_w_jan
rename ER67678 child_support_inc_w_feb
rename ER67679 child_support_inc_w_mar
rename ER67680 child_support_inc_w_apr
rename ER67681 child_support_inc_w_may
rename ER67682 child_support_inc_w_jun
rename ER67683 child_support_inc_w_jul
rename ER67684 child_support_inc_w_aug
rename ER67685 child_support_inc_w_sep
rename ER67686 child_support_inc_w_oct
rename ER67687 child_support_inc_w_nov
rename ER67688 child_support_inc_w_dec
rename ER67541 g60d_wtr_wf_recd_otr_welfare
rename ER67545 other_welfare_inc_w_jan
rename ER67546 other_welfare_inc_w_feb
rename ER67547 other_welfare_inc_w_mar
rename ER67548 other_welfare_inc_w_apr
rename ER67549 other_welfare_inc_w_may
rename ER67550 other_welfare_inc_w_jun
rename ER67551 other_welfare_inc_w_jul
rename ER67552 other_welfare_inc_w_aug
rename ER67553 other_welfare_inc_w_sep
rename ER67554 other_welfare_inc_w_oct
rename ER67555 other_welfare_inc_w_nov
rename ER67556 other_welfare_inc_w_dec
rename ER67592 g61_wtr_wf_recd_pens_annuity
rename ER67596 pension_annuity_w_jan
rename ER67597 pension_annuity_w_feb
rename ER67598 pension_annuity_w_mar
rename ER67599 pension_annuity_w_apr
rename ER67600 pension_annuity_w_may
rename ER67601 pension_annuity_w_jun
rename ER67602 pension_annuity_w_jul
rename ER67603 pension_annuity_w_aug
rename ER67604 pension_annuity_w_sep
rename ER67605 pension_annuity_w_oct
rename ER67606 pension_annuity_w_nov
rename ER67607 pension_annuity_w_dec
rename ER67709 help_fr_relatives_wf_jan
rename ER67710 help_fr_relatives_wf_feb
rename ER67711 help_fr_relatives_wf_mar
rename ER67712 help_fr_relatives_wf_apr
rename ER67713 help_fr_relatives_wf_may
rename ER67714 help_fr_relatives_wf_jun
rename ER67715 help_fr_relatives_wf_jul
rename ER67716 help_fr_relatives_wf_aug
rename ER67717 help_fr_relatives_wf_sep
rename ER67718 help_fr_relatives_wf_oct
rename ER67719 help_fr_relatives_wf_nov
rename ER67720 help_fr_relatives_wf_dec
rename ER67725 help_from_friends_w_jan
rename ER67726 help_from_friends_w_feb
rename ER67727 help_from_friends_w_mar
rename ER67728 help_from_friends_w_apr
rename ER67729 help_from_friends_w_may
rename ER67730 help_from_friends_w_jun
rename ER67731 help_from_friends_w_jul
rename ER67732 help_from_friends_w_aug
rename ER67733 help_from_friends_w_sep
rename ER67734 help_from_friends_w_oct
rename ER67735 help_from_friends_w_nov
rename ER67736 help_from_friends_w_dec
rename ER67737 g63_wtr_wfe_recd_otr_income
rename ER67741 any_other_income_w_jan
rename ER67742 any_other_income_w_feb
rename ER67743 any_other_income_w_mar
rename ER67744 any_other_income_w_apr
rename ER67745 any_other_income_w_may
rename ER67746 any_other_income_w_jun
rename ER67747 any_other_income_w_jul
rename ER67748 any_other_income_w_aug
rename ER67749 any_other_income_w_sep
rename ER67750 any_other_income_w_oct
rename ER67751 any_other_income_w_nov
rename ER67752 any_other_income_w_dec
rename ER67756 g102_wtr_itemize_for_tax
rename ER67766 g106_total_supp_of_otrs
rename ER67803 revised_dividends
rename ER67804 revised_dividends_unit
rename ER67805 w20f_wtr_rec_rev_dividends_jan
rename ER67806 w20f_wtr_rec_rev_dividends_feb
rename ER67807 w20f_wtr_rec_rev_dividends_mar
rename ER67808 w20f_wtr_rec_rev_dividends_apr
rename ER67809 w20f_wtr_rec_rev_dividends_may
rename ER67810 w20f_wtr_rec_rev_dividends_jun
rename ER67811 w20f_wtr_rec_rev_dividends_jul
rename ER67812 w20f_wtr_rec_rev_dividends_aug
rename ER67813 w20f_wtr_rec_rev_dividends_sep
rename ER67814 w20f_wtr_rec_rev_dividends_oct
rename ER67815 w20f_wtr_rec_rev_dividends_nov
rename ER67816 w20f_wtr_rec_rev_dividends_dec
rename ER67834 w31f_wtr_rec_rev_interest_in_jan
rename ER67835 w31f_wtr_rec_rev_interest_in_feb
rename ER67836 w31f_wtr_rec_rev_interest_in_mar
rename ER67837 w31f_wtr_rec_rev_interest_in_apr
rename ER67838 w31f_wtr_rec_rev_interest_in_may
rename ER67839 w31f_wtr_rec_rev_interest_in_jun
rename ER67840 w31f_wtr_rec_rev_interest_in_jul
rename ER67841 w31f_wtr_rec_rev_interest_in_aug
rename ER67842 w31f_wtr_rec_rev_interest_in_sep
rename ER67843 w31f_wtr_rec_rev_interest_in_oct
rename ER67844 w31f_wtr_rec_rev_interest_in_nov
rename ER67845 w31f_wtr_rec_rev_interest_in_dec
/*
rename ER40687 r16_wtr_rec_asset_y_yr_b4_last
rename ER40690 r19_wtr_rec_asset_y_jan_yr_b4lst
rename ER40691 r19_wtr_rec_asset_y_feb_yr_b4lst
rename ER40692 r19_wtr_rec_asset_y_mar_yr_b4lst
rename ER40693 r19_wtr_rec_asset_y_apr_yr_b4lst
rename ER40694 r19_wtr_rec_asset_y_may_yr_b4lst
rename ER40695 r19_wtr_rec_asset_y_jun_yr_b4lst
rename ER40696 r19_wtr_rec_asset_y_jul_yr_b4lst
rename ER40697 r19_wtr_rec_asset_y_aug_yr_b4lst
rename ER40698 r19_wtr_rec_asset_y_sep_yr_b4lst
rename ER40699 r19_wtr_rec_asset_y_oct_yr_b4lst
rename ER40700 r19_wtr_rec_asset_y_nov_yr_b4lst
rename ER40701 r19_wtr_rec_asset_y_dec_yr_b4lst

rename ER40702 r20_wtr_rec_soc_sec_yr_b4lst
rename ER40719 r25_wtr_recd_retirement_yr_b4lst
rename ER40722 r28_wtr_recd_reti_jan_yr_b4lst
rename ER40723 r28_wtr_recd_reti_feb_yr_b4lst
rename ER40724 r28_wtr_recd_reti_mar_yr_b4lst
rename ER40725 r28_wtr_recd_retir_apr_yr_b4lst
rename ER40726 r28_wtr_recd_retir_may_yr_b4lst
rename ER40727 r28_wtr_recd_retir_jun_yr_b4lst
rename ER40728 r28_wtr_recd_retir_jul_yr_b4lst
rename ER40729 r28_wtr_recd_retir_aug_yr_b4lst
rename ER40730 r28_wtr_recd_retir_sep_yr_b4lst
rename ER40731 r28_wtr_recd_retir_oct_yr_b4lst
rename ER40732 r28_wtr_recd_retir_nov_yr_b4lst
rename ER40733 r28_wtr_recd_retir_dec_yr_b4lst
rename ER40734 r29_wtr_rec_va_pension_yr_b4lst
rename ER40737 r32_wtr_rec_va_pens_jan_yr_b4lst
rename ER40738 r32_wtr_rec_va_pens_feb_yr_b4lst
rename ER40739 r32_wtr_rec_va_pens_mar_yr_b4lst
rename ER40740 r32_wtr_rec_va_pens_apr_yr_b4lst
rename ER40741 r32_wtr_rec_va_pens_may_yr_b4lst
rename ER40742 r32_wtr_rec_va_pens_jun_yr_b4lst
rename ER40743 r32_wtr_rec_va_pens_jul_yr_b4lst
rename ER40744 r32_wtr_rec_va_pens_aug_yr_b4lst
rename ER40745 r32_wtr_rec_va_pens_sep_yr_b4lst
rename ER40746 r32_wtr_rec_va_pens_oct_yr_b4lst
rename ER40747 r32_wtr_rec_va_pens_nov_yr_b4lst
rename ER40748 r32_wtr_rec_va_pens_dec_yr_b4lst
rename ER40749 r33_wtr_recd_unemp_comp_yr_b4lst
rename ER40764 r37_wtr_recd_wrks_cmp_yr_b4lst
rename ER40794 wtr_rec_ch_supp_almny_jan_yb4lst
rename ER40828 wtr_rec_ch_supp_almny_feb_yb4lst
rename ER40829 wtr_rec_ch_supp_almny_mar_yb4lst
rename ER40830 wtr_rec_ch_supp_almny_apr_yb4lst
rename ER40831 wtr_rec_ch_supp_almny_may_yb4lst
rename ER40832 wtr_rec_ch_supp_almny_jun_yb4lst
rename ER40833 wtr_rec_ch_supp_almny_jul_yb4lst
rename ER40834 wtr_rec_ch_supp_almny_aug_yb4lst
rename ER40835 wtr_rec_ch_supp_almny_sep_yb4lst
rename ER40836 wtr_rec_ch_supp_almny_oct_yb4lst
rename ER40837 wtr_rec_ch_supp_almny_nov_yb4lst
rename ER40838 wtr_rec_ch_supp_almny_dec_yb4lst
rename ER40854 r63_wtr_any_otr_income_2_yrs_ago
rename ER40855 r66_amt_of_income_2_yrs_ago
rename ER40856 r66_per_for_amt_of_inc_2_yrs_ago
rename ER40857 r67_wtr_recd_incom_jan_2_yrs_ago
rename ER40858 r67_wtr_recd_incom_feb_2_yrs_ago
rename ER40859 r67_wtr_recd_incom_mar_2_yrs_ago
rename ER40860 r67_wtr_recd_incom_apr_2_yrs_ago
rename ER40861 r67_wtr_recd_incom_may_2_yrs_ago
rename ER40862 r67_wtr_recd_incom_jun_2_yrs_ago
rename ER40863 r67_wtr_recd_incom_jul_2_yrs_ago
rename ER40864 r67_wtr_recd_incom_aug_2_yrs_ago
rename ER40865 r67_wtr_recd_incom_sep_2_yrs_ago
rename ER40866 r67_wtr_recd_incom_oct_2_yrs_ago
rename ER40867 r67_wtr_recd_incom_nov_2_yrs_ago
rename ER40868 r67_wtr_recd_incom_dec_2_yrs_ago

rename ER40916 acc_market_garden_income_of_head
rename ER40918 acc_of_head_addtional_job_income
*/
** Rent (for state taxes).
rename ER66030 own_rent_or_what
rename ER66090 rent_amount
rename ER66091 rent_amount_unit
rename ER66095 rent_include_heat
rename ER66071 rent_paid_by_govt
rename ER66098 home_equivalent_rent
rename ER66099 home_equivalent_rent_unit
** Taxes.
rename ER66045 property_tax_annual
** Deductions.
** Strange bug from PSID dofile.
rename g102_wtr_itemize_for_tax whether_itemized
rename ER67757 itemized_charitable
rename ER67758 itemized_medical
** Child care.
rename ER66744 childcare_expense
rename ER66745 childcare_expense_unit
rename ER67770 alimony_given
** Mortgage payments.
rename ER66050 mortgage1_original_or_refinanced
rename ER66051 mortgage1_principle_remaining
rename ER66053 mortgage1_payment
rename ER66058 mortgage1_interest_rate_wholenum
rename ER66059 mortgage1_interest_rate_fraction
rename ER66057 mortgage1_fixed_variable
rename ER66060 mortgage1_year_of_loan
rename ER66061 mortgage1_years_left
rename ER66069 mortgage2_binary
rename ER66070 mortgage2_type
*WHY ARE THEY NOT IN THE DATASET? WEIRD. THEY SHOULD BE
*rename ER66071 mortgage2_original_or_refinanced
*rename ER66072 mortgage2_principle_remaining
*rename ER66074 mortgage2_payment
*rename ER66079 mortgage2_interest_rate_wholenum
*rename ER66080 mortgage2_interest_rate_fraction
*rename ER66078 mortgage2_fixed_variable
*rename ER66081 mortgage2_year_of_loan
*rename ER66082 mortgage2_years_left
*rename ER66055 mortage1_include_proptaxes
*rename ER66056 mortgage1_include_insurance

** Food consumption.
rename ER66784 monthly_food_stamps 
gen food_stamps=12*monthly_food_stamps
//it is last month, not last year!
*rename ER36703 food_stamps_unit
rename ER66787 food_homestamps
rename ER66788 food_homestamps_unit
rename ER66791 food_deliveredstamps
rename ER66792 food_deliveredstamps_unit
rename ER66794 food_awaystamps
rename ER66795 food_awaystamps_unit
rename ER66797 food_home
rename ER66798 food_home_unit
rename ER66801 food_delivered
rename ER66802 food_delivered_unit
rename ER66804 food_away
rename ER66805 food_away_unit

** GENERATED FIELDS.
rename ER71269 unincorp_bus_inc_hh_gen
rename ER71274 unincorp_laborpt_inc_head_gen
rename ER71275 unincorp_assetpt_inc_head_gen
rename ER71272 farm_inc_head_gen
rename ER71277 wagesal_inc_head_gen
rename ER71279 bonus_inc_head_gen
rename ER71281 overtime_inc_head_gen
rename ER71283 tips_inc_head_gen
rename ER71285 commission_inc_head_gen
rename ER71287 trade_inc_head_gen
*rename ER40915 gardening_inc_head_gen
rename ER71289 addljob_inc_head_gen
rename ER71293 labor_inc_head_gen
rename ER71294 rent_inc_head_gen
rename ER71296 dividend_inc_head_gen
rename ER71298 interest_inc_head_gen
*rename ER71300 trustroyalty_inc_head_gen

rename ER71302 unincorp_laborpt_inc_wife_gen
rename ER71303 unincorp_assetpt_inc_wife_gen
rename ER71321 labor_inc_wife_gen 
rename ER71322 rent_inc_wife_gen
rename ER71324 dividend_inc_wife_gen
rename ER71326 interest_inc_wife_gen
rename ER71328 trustroyalty_inc_wife_gen

rename ER71330 taxable_inc_hh_gen

rename ER71331 tanf_inc_head_gen
rename ER71333 ssi_inc_head_gen
rename ER71335 otherwelfare_inc_head_gen
rename ER71337 vapension_inc_head_gen
rename ER71339 nonva_retire_inc_head_gen
rename ER71343 annuities_inc_head_gen
rename ER71347 unemployment_inc_head_gen
rename ER71349 workerscomp_inc_head_gen
rename ER71351 childsupport_inc_head_gen
rename ER71353 alimony_inc_head_gen
rename ER71355 helprelatives_inc_head_gen
rename ER71357 helpothers_inc_head_gen
rename ER71359 misc_xfers_inc_head_gen

rename ER71361 tanf_inc_wife_gen
rename ER71363 ssi_inc_wife_gen
rename ER71365 otherwelfare_inc_wife_gen

rename ER71371 spouse_annuities
rename ER71369 spouse_retirement_pensions

gen retire_annuities_inc_wife_gen=spouse_annuities+spouse_retirement_pensions

rename ER71377 unemployment_inc_wife_gen
rename ER71379 workerscomp_inc_wife_gen
rename ER71381 childsupport_inc_wife_gen
rename ER71385 helprelatives_inc_wife_gen
rename ER71387 helpothers_inc_wife_gen
rename ER71389 misc_xfers_inc_wife_gen

rename ER71420 socsec_inc_head_gen
rename ER71422 socsec_inc_wife_gen

rename ER66492 hr_wage_spouse
rename ER66217 hr_wage_hd
rename ER67046 tot_wage_hd
rename ER67401 tot_wage_spouse
rename ER71233 tot_hs_worked_head
rename ER71254 tot_hs_worked_spouse


rename ER70941 religion_hd
rename ER70803 religion_spouse
rename ER71531 rural

rename ER67287 whether_unemployed_head
rename ER67641 whether_unemployed_spouse

drop ER*

save fam2017er-small.dta, replace

